/**
 * Copyright (c) 2016-2019 酷猪开源 All rights reserved.
 *
 * https://www.koopig.com
 *
 * 版权所有，侵权必究！
 */

package com.koo.modules.sys.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.koo.common.base.entity.CommonEntity;
import com.koo.common.validator.group.AddGroup;
import com.koo.common.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * 系统用户
 *
 * @author charlin
 */
@Data
@TableName("sys_user")
public class SysUserEntity extends CommonEntity {

	@TableId
	private Long userId;

	@ApiModelProperty(value = "用户名")
	@NotBlank(message="用户名不能为空", groups = {AddGroup.class, UpdateGroup.class})
	private String username;

	@ApiModelProperty(value = "密码")
	@NotBlank(message="密码不能为空", groups = AddGroup.class)
	private String password;

	@ApiModelProperty(value = "盐")
	private String salt;

	@ApiModelProperty(value = "邮箱")
	@NotBlank(message="邮箱不能为空", groups = {AddGroup.class, UpdateGroup.class})
	@Email(message="邮箱格式不正确", groups = {AddGroup.class, UpdateGroup.class})
	private String email;

	@ApiModelProperty(value = "手机号")
	private String mobile;

	@ApiModelProperty(value = "地址")
	private String address;

	@ApiModelProperty(value = "部门Id")
	private Long deptId;

	@ApiModelProperty(value = "部门名称")
	private String deptName;


	@ApiModelProperty(value = "用户类型  0系统用户，1门店用户，2商城用户")
	private Integer userType;

	@ApiModelProperty(value = "年龄")
	private Integer age;

	//---------------------------------------------------------

	@TableField(exist=false)
	private List<Long> roleIdList;

	@TableField(exist=false)
	private List<SysRoleEntity> roleList;

}
